/** @format */
import { get, set } from '@vueuse/core';
import { defineStore } from 'pinia';
import { computed, ref } from 'vue';
// apis
// hooks
// utils
// stores
// mixins
// configs
// components

export const useStoreSystem = defineStore(
  'storeSystem',
  () => {
    const COLLAPSED = ref(false);

    const computedCollapsed = computed(() => get(COLLAPSED));

    const setCollapsed = (collapsed) => {
      try {
        set(COLLAPSED, collapsed);
      } catch (error) {
        console.warn(error);
      }
    };

    return {
      COLLAPSED,
      computedCollapsed,
      setCollapsed,
    };
  },
  { persist: { storage: sessionStorage } },
);
